PUBLIC = ../../public
SRC = src
BIN = ../../bin
CFLAGS = -Wall -pedantic -ansi -Werror
CC = gcc
LIB_TOOL = ar
LIB_FLAGS = -r -s
COMPILE_FLAG = -c

all: release 

debug: CFLAGS+=-g 
debug: BIN=../../bin/debug
debug: $(BIN)/libMPool.a clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		 LIBRARY CREATED			*"
	@echo "*							*"
	@echo "**********************************************************"

release: CFLAGS+=-g -DNDEBUG
release: BIN=../../bin/release
release: $(BIN)/libMPool.a clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		 LIBRARY CREATED			*"
	@echo "*							*"
	@echo "**********************************************************"

$(BIN)/libMPool.a: MPool.o 
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		CREATING LIBRARY			*"
	@echo "*							*"
	@echo "**********************************************************"
	$(LIB_TOOL) $(LIB_FLAGS) $(BIN)/libMPool.a MPool.o 

Testdebug: CFLAGS+=-g -DMPOOL_UTEST
Testdebug: BIN=bin/debug
Testdebug: $(BIN)/MPoolTest clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		SUCCEFULY FINISHED			*"
	@echo "*							*"
	@echo "**********************************************************"


Testrelease: CFLAGS+=-DNDEBUG -DMPOOL_UTEST
Testrelease: BIN=bin/release
Testrelease: $(BIN)/MPoolTest clean
	@echo "**********************************************************"
	@echo "*							*"
	@echo "*		SUCCEFULY FINISHED			*"
	@echo "*							*"
	@echo "**********************************************************"

$(BIN)/MPoolTest: MPool.o
	$(CC) $(CFLAGS) MPool.o -o $(BIN)/MPoolTest


MPool.o: $(PUBLIC)/MPool.h MPool.c
	$(CC) $(COMPILE_FLAG) $(CFLAGS) -I$(PUBLIC) MPool.c -o MPool.o





clean: 
	rm *.o
